<admintpl file="header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>专栏作者</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('AdminProfessor/professor_list')}">
        <input type="text" name="name" style="width: 200px;" value="{:I('request.username')}" placeholder="用户名">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:U('AdminProfessor/professor_list')}">清空</a>
    </form>
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th style="width: 50px;">排序</th>
                <th>ID</th>
                <th>用户名</th>
                <th>头像</th>
                <th>职位</th>
                <th>公司</th>
                <th>申请时间</th>
                <th>更新时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <php>$pf_statuses=array("0"=>"待审核","1"=>"正常","2"=>"已取消");</php>
            <foreach name="pf_list" item="vo">
                <tr>
                    <td><input data-id="{$vo.pf_id}" class="input input-order" type="text" size="5" value="{$vo.pf_order}"></td>
                    <td align="center">{$vo.id}</td>
                    <td><a href="{:U('AdminProfessor/pf_info',array('id'=>$vo['pf_id']))}">{$vo['user_nicename'] ?: $vo['user_login']}</a></td>
                    <td style="text-align: center;"><img width="25" height="25" style="border-radius: 50%;" src="{:sp_get_user_avatar_url($vo['avatar'])}" /></td>
                    <td>{$vo.position}</td>
                    <td>{$vo.company}</td>
                    <td>{$vo.created_at}</td>
                    <td>{$vo.updated_at}</td>
                    <td>{$pf_statuses[$vo['status']]}</td>
                    <td align="center">
                        <a href="{:U('AdminProfessor/operate_pf',array('id'=>$vo['pf_id'], 'type' => 'del'))}" class="js-ajax-dialog-btn" data-msg="确定取消专栏作者？">取消</a>|
                        <a href="{:U('AdminProfessor/operate_pf',array('id'=>$vo['pf_id'], 'type' => 'add'))}" class="js-ajax-dialog-btn" data-msg="确定开启专栏作者？">开启</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    $(document).ready(function () {
        $('body').delegate('.input-order', 'change', function () {
            var order 	= $(this).val();
            var id 		= $(this).attr('data-id');
            $.get("{:U('AdminProfessor/change_pf_order')}", {id : id, order : order}, function (data) {
                if (data.status) {
                    window.location.reload();
                }
            })
        })
    })
</script>
</body>
</html>